package com.maket.scxx.service.impl;

import com.maket.scxx.domain.*;
import com.maket.scxx.mapper.GylxConfigMapper;
import com.maket.scxx.service.GylxConfigService;
import com.ruoyi.system.api.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@SuppressWarnings("all")
@Service
public class GylxConfigServiceImpl implements GylxConfigService {
    @Autowired
    private GylxConfigMapper gylxConfigMapper;


    @Override
    public GylxProcessRoute selectWithGylxAndGx(GxProcessAndGylxProcessRoute gyRoadCodeAndGxCode) {
        return gylxConfigMapper.selectWithGylxAndGx(gyRoadCodeAndGxCode);
    }

    @Override
    public int insertGylxAndGx(GxProcessAndGylxProcessRoute gylxProcessRoute) {
        return gylxConfigMapper.insertGylxAndGx(gylxProcessRoute);
    }

    @Override
    public List<GxProcess> selectGxProcessList(GxProcess gxProcess) {
        return gylxConfigMapper.selectGxProcessList(gxProcess);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteGxAndGylx(GxProcessAndGylxProcessRoute gxProcessAndGylxProcessRoute) {
        GxProcessAndSysUser gxProcessAndSysUser = new GxProcessAndSysUser();
        gxProcessAndSysUser.setGxCode(gxProcessAndGylxProcessRoute.getGxCode());
        gxProcessAndSysUser.setGyroadCode(gxProcessAndGylxProcessRoute.getGyroadCode());
        GxProcessAndScwzRoductionLocation gxProcessAndScwzRoductionLocation = new GxProcessAndScwzRoductionLocation();
        gxProcessAndScwzRoductionLocation.setGxCode(gxProcessAndGylxProcessRoute.getGxCode());
        gxProcessAndScwzRoductionLocation.setGyroadCode(gxProcessAndGylxProcessRoute.getGyroadCode());
        deleteGxAndScdy(gxProcessAndScwzRoductionLocation);
        deleteGxAndUser(gxProcessAndSysUser);
        return gylxConfigMapper.deleteGxAndGylx(gxProcessAndGylxProcessRoute);
    }

    @Override
    public List<GcFactoryUnitTable> getAllScdy(GcFactoryUnitTable gcFactoryUnitTable) {
        return gylxConfigMapper.getAllScdy(gcFactoryUnitTable);
    }

    @Override
    public int insertGxAndScdy(GxProcessAndScwzRoductionLocation gxProcessAndScwzRoductionLocation) {
        return gylxConfigMapper.insertGxAndScdy(gxProcessAndScwzRoductionLocation);
    }

    @Override
    public int deleteGxAndScdy(GxProcessAndScwzRoductionLocation gxProcessAndScwzRoductionLocation) {
        return gylxConfigMapper.deleteGxAndScdy(gxProcessAndScwzRoductionLocation);
    }

    @Override
    public int insertGxAndUser(GxProcessAndSysUser gxProcessAndSysUser) {
        return gylxConfigMapper.insertGxAndUser(gxProcessAndSysUser);
    }

    @Override
    public int deleteGxAndUser(GxProcessAndSysUser gxProcessAndSysUser) {
        return gylxConfigMapper.deleteGxAndUser(gxProcessAndSysUser);
    }

    @Override
    public List<GxUser> getAllUser(GxUser sysUser) {
        return gylxConfigMapper.getAllUser(sysUser);
    }

    @Override
    public int updateSort(GxProcessAndGylxProcessRoute gylxProcessRoute) {
        return gylxConfigMapper.updateSort(gylxProcessRoute);
    }

    @Override
    public List<GxProcessAndGylxProcessRoute> selectWithGxCode(String gxCode) {
        return gylxConfigMapper.selectWithGxCode(gxCode);
    }

}
